<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>${message("999")}</title>
<link href="/resources/css/main.css" rel="stylesheet" type="text/css" />
 <link href="/resources/css/common.css" rel="stylesheet" type="text/css" />
 <link rel="icon" href="/resources/images/lock-head-logo.png" type="image/x-icon"/>
 <script type="text/javascript" src="/resources/js/reference/jquery.js"></script>
 <script type="text/javascript" src="/resources/js/base/dialog.js"></script>
 <script type="text/javascript" src="/resources/js/base/request.js"></script>
 <script type="text/javascript" src="/resources/js/base/global.js"></script>
 <script type="text/javascript" src="/resources/js/reference/jquery.validate.js"></script>
 <style type="text/css">
 /**
 .leftside-box{position:relative;!important}
 .leftside-box dl{position:static;height:80px;}
 .leftside-box dl.on{background-color:#089CD4;!important}
 
 .leftside-box dl dt{height:80px;padding:0;text-align:center;!important}

 .leftside-snav{width:840px;position:absolute;top:51px;left:100%;min-height:310px;!important}*/

 .leftside-box .hov:hover{background-color:#005792;!important}
 .leftside-box dl #a-l:hover{background-color:#005792;!important}
 .leftside-box dl #a-r:hover{background-color:#005792;!important}
 .leftside-snav ul{position:relative;border-right:none;border-left:none;border-bottom:1px dashed #e0e0e0;padding:0 0 0 100px;margin:10px 25px 0 25px;min-height: 34px;width:685px;!important;clear: both !important;}
 .leftside-snav ul:first-child{margin-top:0;!important}
 .leftside-snav ul h3{float:left;position:absolute;left:0;font-size:14px;!important}
 .leftside-snav ul li{float:left;list-style-type:none;margin-left:17px;padding:0 0 15px 0;width:120px;!important}
 .leftside-snav ul li a{font-size:12px;!important}
 .pic{display:block;margin:0 auto 10px;!important}
 #left-warming:after{display:none}
 </style>
<script type="text/javascript">
function open_new_tab(e){
	var tid = $(e).attr("data-id");
	var reflush = $(e).attr("reflush"); 
	var tname = $(e).attr("data-name");
	if(tname!=undefined && (tid=="" || tid==undefined)){
		var $i = $("a.link-btn[data-name='"+tname+"']");
		if($i!=undefined && $i.length>0){
			tid = $i.attr("data-id");
			$(e).attr("data-id",tid);
		}else{
			var second_id = $(e).attr("second-id");
			if(second_id!=undefined && second_id!=""){
				tid = second_id;
				$(e).attr("data-id",tid);
			}else{
				return false;
			}
			
		}
	}
	var tsrc=$(e).attr("data-src");
	var status = true;
	var $this = $(".h-Topbar li");
	var size = $('[superId="'+$(e).attr("val")+'"].nav-third > a').length;
	if(size>0){
		return false;
	}
	$this.each(function(){
		var txt = $(this).attr("data-id");
		if(tid == txt){
			status = false;
            return false;	
		}
	});
	if(status){
		if($this.length>=20){
			$.message_alert('最多只能打开20个窗口，请先关闭一些窗口！');
			return false;
		}
		$this.removeClass("cur");
		var str = '';
		if(reflush=='true'){
			str = ',true';
		}
		$(".h-Topbar ul").append('<li data-id="'+tid+'" onclick="changeTab(this'+str+')" class="topbar-'+tid+' cur" title="'+tname+'"><a href="#">'+tname+'</a><i class="js-close" onclick="closeTab(this)"></i></li>')
		$(".mainContent > div").hide();
		
		var $content = $('<div class="tab-lable-'+tid+'" style="display:block"><iframe src="'+ tsrc +'"  style="width: 100%;height: 100%;"></iframe></div>');
		$(".mainContent").append($content);
	
	}else{
		var $obj = $(".mainContent").find(".tab-lable-"+ tid +"");
		var $iframe = $obj.find("iframe");
		var url = $iframe.attr("src")
		if(tsrc!=undefined && tsrc!=''){
			url = tsrc;
		}
		$iframe.attr("src",url);
		$obj.show().siblings().hide();
		$(".topbar-"+tid).addClass("cur").siblings().removeClass("cur")
	}
}

var listMap={};
$().ready(function(e) {
	var h1 = $(window).height();
	var h = h1 -$(".left-box > .admin-info").outerHeight() - $(".left-box > .copyright").outerHeight();
	
	$("#warming").bindQueryBtn({
		type:'warningMessageProcess',
		title:'${message("警报列表")}',
		url:'/warning_message_process/select_warning_list.jhtml'
	});
// 	$("#noticing").bindQueryBtn({
// 		type:'terminalNotifyMessage',
// 		title:'${message("通知列表")}',
// 		height:h1-31,
// 		width:$(window).width()-80,
// 		url:'/terminal_notify_message/list.jhtml'
// 	});
	
	//$("#left-warming").bindQueryBtn({
	//	type:'warningMessageProcess',
	//	title:'${message("警报列表")}',
	//	url:'/warning_message_process/select_warning_list.jhtml'
	//});
	
	//报警
	getwarmStatus();
	//通知
	getnoticeStatus();
 	window.setInterval(function() {
 		getwarmStatus();
		getnoticeStatus();
 	}, 30000);
});

function getwarmStatus() {
	$.ajax({
		url: "/warning_message_process/getNoProcess.jhtml",
		type: "POST",
		dataType: "json",
		cache: false,
		async:false, 
		success: function(data) {
			if (data.objx == 0) {
				$("#warming").css("background", "url(/resources/images/isAlarm_off.png) no-repeat center");
			} else {
				$("#warming").css("background", "url(/resources/images/isAlarm.gif) no-repeat center");
			}
		}
	});
}
function getnoticeStatus() {
	$.ajax({
		url: "/terminal_notify_message/getNoProcess.jhtml",
		type: "POST",
		dataType: "json",
		cache: false,
		async:false, 
		success: function(data) {
			if (data.objx == 0) {
				$("#noticing").css("background", "url(/resources/images/notice_off.png) no-repeat center");
			} else {
				$("#noticing").css("background", "url(/resources/images/notice.gif) no-repeat center");
			}
		}
	});
}
function changeTab(e,reflush){
	var tid = $(e).attr("data-id");
	var $div = $(".tab-lable-"+ tid +"");
	$div.show().siblings().hide();
	$(".topbar-"+tid).addClass("cur").siblings().removeClass("cur");
	if(reflush==true){
		var $iframe = $div.find("iframe");
		var src = $iframe.attr("src");
		$iframe.attr("src",src);
	}
}
function closeTab(e){
	var tid = $(e).parent().attr("data-id");
	$(".h-Topbar li").removeClass("cur");
	$(e).parent().prev().addClass("cur")
	$(e).parent().remove();
	$(".mainContent > div").hide();
	$(".mainContent").find(".tab-lable-"+ tid +"").prev().show()
	$(".mainContent").find(".tab-lable-"+ tid +"").remove()
}
function topbarCloseall(e){

	$(".h-Topbar").find("li").eq(0).addClass("cur");
	$(".h-Topbar").find("li").not(":first").remove();
	
	$(".mainContent").find("div").not(":first").remove();
	$(".tab-lable-index").css('display','block');
	
}

$(function(){
    $(".leftside-box dt").mouseover(function(){
       $(this).parent().addClass("on").siblings().removeClass("on");
	   var w1 = 10;
	   var h1 = 0 ;
	   var $snav = $(this).parent().find(".leftside-snav");
	   var $ul = $snav.find("ul");
	   for(var i=0 ; i <= $ul.length ;i++){
		  var w = $ul.eq(i).outerWidth() + 78;
		  if(w>w1){
		 	 w1 = w;
		  }
	   }
	   $snav.width(w1);
	   var wh = $(window).height();
	   var sh1 = $(this).parent().offset().top;
	   var sh2 = $snav.outerHeight()
	   var sh = wh-(sh1+sh2);
	   
	   var hd = 20;
	   var  xhd = sh-hd;//移动距离+固定值
	   if(sh>=0 && sh<hd && sh1>-xhd){//下间距>hd, 上间距> -xhd
	   		var bd = xhd-55;
	   		$snav.css("margin-top",bd+"px");
	   }else if(sh<0){
	   		var bd = sh-55;
	   		if(sh1>=-xhd){//上间距 >=  -xhd
	   			bd = bd-hd;
	   		}
	   		$snav.css("margin-top",bd+"px");
	   }
	   
    });

	$(".leftside-box dl").mouseleave(function(){
		$(".leftside-box dl").removeClass("on");
	});

});

function edit_member(url){
	var w = 800;
	var h = 300;
	var memberName=$("#memberName").html();
	var check_js='<script type="text/javascript">$().ready(function() {var $inputForm = $("#editForm");$inputForm.validate({rules: {'
			+'mobile: {required:true},'
			+'password: {pattern: /^[^\s&\"<>]+$/,minlength: ${setting.passwordMinLength},maxlength: ${setting.passwordMaxLength}},'
			+'rePassword: {equalTo: "#password"}},'
			+'submitHandler:function(form){return false;}});})<\/script>';
	
	
	var content =check_js+ '<form id="editForm" action="update_info.jhtml" method="post" type="ajax" validate-type="validate"><table class="input input-edit" style="width:100%">'
		+'<tbody>'
		+'<tr><th>${message("15023")}:</th><td>${member.username}<input type="hidden" name="id" value="${member.id}"></td>'
		+'<th>${message("登录密码")}:</th><td><span class="error-msg"><input type="text" id="password" name="password" value="" class="text" maxlength="20" btn-fun="clear" autocomplete="off" onfocus="this.type=\'password\'" /></span></td>'
		+'<th>${message("确认登录密码")}:</th><td><span class="error-msg"><input type="text" name="rePassword" class="text" maxlength="20" btn-fun="clear" autocomplete="off" onfocus="this.type=\'password\'" /></span></td></tr>'
		+'<tr><th>${message("手机")}:</th><td>${member.mobile}</td>'
		+'<th>${message("姓名")}:</th><td><input type="text" name="name" class="text" value="'+memberName+'" btn-fun="clear"/></td>'
		+'<th>${message("用户类型")}:</th><td>${message("业务系统用户")}</td></tr>'
		+'</tbody></table></form>';
	var $dialog = $.dialog({
		title:'${message("修改个人信息")}',
		width:w,
		height:h,
		content: content,
		onOk:function(){
			$.ajax({
				url: "/member/update_info.jhtml",
				type: "POST",
				data: $("#editForm").serialize(),
				dataType: "json",
				cache: false,
				async:false, 
				success: function(resultMsg) {
					$.message_timer(resultMsg.type,resultMsg.content,1000,function(){
					});
					$("#memberName").html($("input[name='name']").val());
// 					if(resultMsg.type=='error'){
// 						return flase;
// 					}
				}
			})
		}
		
	});
	
	

}
function notice_view(){
	var w = $(window).width();
	var h = $(window).height()*0.92;
	var iframeId = "iframeId" + (new Date()).valueOf() + Math.floor(Math.random() * 1000000);
	var $dialog = $.dialog({
		title:'通知列表',
		width:1200,
		height:h,
		content: "<iframe  id='"+iframeId+"' src='/terminal_notify_message/select_list.jhtml' width='100%'  height='"+(h-50-69)+"px'><\/iframe>",
		ok: "确定",
		cancel: "取消",
		onOk: function() {
		
		}
	});
	$dialog.find(".dialogContent").css("height", (h-77)+"px");
	$dialog.css("max-height",(h-31)+"px").css("top",31+"px");
}
</script>
</head>
<body style="opacity: 1;" id="top-flag">
<script type="text/javascript">
	
function logout(e) {
	ajaxSubmit(e,{
		url:'/logout.jhtml',
		method:'post',
		callback:function(data){
			window.location.href = data.objx;
		}
	});
}

</script>
<div class="left-box">
  <div class="admin-info" style="padding: 0px 0 8px;">
  	<div class="admin-para">
        <!--<a href="javascript:void(0);"  class="exit" title="退出"  onclick="logout(this)"></a>
        <a href="javascript:void(0);" onclick="open_new_tab(this)" data-id="x2" data-src="/wf/wf_manage/list.jhtml" data-name="流程查询" class="ico-flow link-btn" title="流程查询"></a>-->
        <!--<a href="javascript:void(0);" onclick="open_new_tab(this)" data-id="x2" data-src="http://www.hao123.com" data-name="产品库" class="ico-cpk link-btn" title="产品库"></a>
        <a href="javascript:void(0);" onclick="open_new_tab(this)" data-id="x3" data-src="/custom/services/list.jhtml" data-name="案例库" class="ico-alk link-btn" title="案例库"></a>
        <a href="javascript:void(0);" onclick="open_new_tab(this)" data-id="x4" data-src="http://www.hao123.com" data-name="消息" class="ico-notice cur link-btn" title="消息"></a>
        <a href="http://starsshop.5mall.com/chat/msg.jsp?username=客服1&password=888888" class="kefu" target="_blank"></a>-->
    </div>
    	
    	<div class="u-header" style="height: 32px;"> 
    	<a href="javascript:void(0);" onclick="edit_member('/member/edit.jhtml?id=${member.id}&flag=1')"> 
    		<img src="[#if member.imageName??]${member.imageName}[#else]/resources/images/logo_tran.png[/#if]" style="width: 70px;left: 5px;height: 20px;border-radius: 0;border: none;"> 
    	</a> 
    	</div>
<!--     	<div class="u-name">电子锁</br>管理平台</div> -->
   		<div class="[#if companyInfoName!=null]qy[#else]disqy[/#if]">
	   		<b id="memberName">[#if member.name!=null]${member.name}[#else]${member.username}[/#if]</b>
	    	[#if companyInfo!=null]<p>(${companyInfo.company_name})</p>[/#if]
    	</div>   
  </div>
  <div class="leftside-box">
	<!--<dl>
    	<a href="javascript:void(0);" id="a-l" onclick="open_new_tab(this)" data-id="product_list" data-src="/product/product/list_pc.jhtml" data-name="产品展示" title="产品展示"><i class="icon-pro"></i></a>
        <a href="javascript:void(0);" id="a-r" onclick="open_new_tab(this)" data-id="cart_list" data-src="/b2b/cart/list.jhtml" data-name="购物车" reflush='true' title="购物车"><i class="icon-cart"></i></a>
    </dl>-->
    [#list menu_list as menu]
	    [#if menu.grade==0 && menu.isEnabled]
	    [#assign count=0]
        [#list menu_list as menu_sub]
            [#if menu_sub.superId==menu]
                	[#assign count=count+1]
            [/#if]
    	[/#list]
    	[#if count > 0]
	    <dl class="hov">
	        <dt style="background:url(${menu.menuImg}) no-repeat;border-left: medium none;" title="${message("${menu.menuName}")}"></dt>
	       [#--
	       	<dt>
		        <img class="pic" src="/resources/images/button/a-icon.png">
		        ${message("${menu.menuCode}")}
	        </dt>--]
	        <dd class="leftside-snav">
	        	[#list menu_list as menuChildren]
	        		[#if menu== menuChildren.superId && menuChildren.isEnabled]
			        	<ul>
			            	<h3>${menuChildren.menuCode}</h3>
		            		[#list menu_list as menuChildrenChildren]
		            			[#if menuChildren == menuChildrenChildren.superId && menuChildrenChildren.isEnabled]
		            			<li>
		            				<a href="javascript:void(0)" class="link-btn" onclick="open_new_tab(this)" data-id="${menuChildrenChildren.id}" data-src="[#if menuChildrenChildren.url?index_of("company_info/edit.jhtml") != -1]${menuChildrenChildren.url}?id=${companyInfo.id}[#else]${menuChildrenChildren.url}[/#if]" data-name="${message("${menuChildrenChildren.menuCode}")}" val="${menuChildrenChildren.id}">${message("${menuChildrenChildren.menuCode}")}</a>
		            			</li>
		            			[/#if]
		                	[/#list]
			            </ul>
		            [/#if]
	            [/#list]
	        </dd>
	      </dl>
	      [/#if]
	      [/#if]
     [/#list]
     
     <!-- <dl class="hov">
	        <dt id="left-warming" style="background:url(/resources/images/warming-32x32.png) no-repeat;border-left: medium none;" title="警报"></dt>
	 </dl>
     <img class="logo" src="/resources/images/logo.png" style="width: 70px;position: absolute;bottom: 5px;left: 5px;" /> -->
  </div>
</div>
<div class="h-Topbar" style="z-index:0;">
	<ul>
		<li data-id="index" onclick="changeTab(this)" class="topbar-index cur"><a href="#">[#if companyInfo??]实时监控[#else]首页[/#if] </a>
		<a [#if companyInfo??]href="/realtime_monitor/list.jhtml"[/#if] target="mainiframe1">
		<img src="/resources/images/button/ico-break.png" style="margin-top: -2px;" /></a></li>
	</ul>
	<div class="topbar-oper" style="width: 150px;">
		<a href="javascript:void(0)" [#-- class="prev" --] onclick="topbarPrev(this)"></a>
		[#-- <a href="javascript:void(0)" class="next" onclick="topbarPrev(this)"></a> --] 
		<a href="javascript:void(0)" id="noticing" class="noticing"  onclick="notice_view()" title="消息通知" [#if companyInfo?? ][#else]style="visibility:hidden"[/#if]></a>
		<a href="javascript:void(0)" id="warming" class="warming" title="警报" [#if companyInfo??][#else]style="visibility:hidden"[/#if]></a>
		<a href="javascript:void(0)" class="close-all" title="全部关闭" onclick="topbarCloseall(this)"></a>
		<a href="javascript:void(0)" class="exit" title="退出" onclick="logout(this)" style="background: url(/resources/images/logo_exit.png) no-repeat 0 center;"></a>
	</div>
</div>
<div class="mainContent">
	<div class="tab-lable-index">
	[#if companyInfo??]
	<iframe name="mainiframe1" id="mainiframe1" src="/realtime_monitor/list.jhtml" style="border: none;width: 100%;height: 100%;">
	</iframe>
	[#else]
	<iframe name="mainiframe1" id="mainiframe1" style="border: none;width: 100%;height: 100%;">
	</iframe>
	[/#if]
	</div>
</div>
<script>
$().ready(function(e) {
    $("#js-menu dt").click(function(){
		$(this).parent().toggleClass("on").siblings().removeClass("on");
	});
    $("#js-menu dd a").click(function(){
        $(".leftMenu dd a").removeClass("on")
        $(this).addClass("on");
    });
});
function editProfile(){
	$("#mainiframe").attr("src","/business/profile/edit.jhtml");
}
</script>
</body>
</html>